package f.h.dragon.patterns.gateway;

import junit.framework.TestCase;

/**
 * MessageGateWayTester: test
 *
 * @author Wenlong Meng(wenlong.meng@gmail.com)
 * @version 1.0 at 2012/04/23
 * @since 1.0
 */
public class MessageGateWayTester extends TestCase {
	
	//test
	/**
	 * test null arg
	 */
	public void testSendNullArg(){
		try{
			gate().sendConfirmation(null, 5, "FHDragon");
			fail("Didn't detect null argument");
		}catch(Exception e){
			
		}
		assertEquals(0, gate().getMessagesSent());
	}

	/**
	 * gate 
	 * 
	 * @return
	 */
	private MessageGatewayStub gate() {
		return (MessageGatewayStub)Environment.getMessageGateway();
	}

	/**
	 * init resource
	 * 
	 * @see junit.framework.TestCase#setUp()
	 */
	@Override
	protected void setUp() throws Exception {
		super.setUp();
		Environment.testInit();
	}

	/**
	 * release resource
	 * 
	 * @see junit.framework.TestCase#tearDown()
	 */
	@Override
	protected void tearDown() throws Exception {
		super.tearDown();
	}

}
